﻿Public Partial Class Login
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnOK_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnOK.Click
        Dim ta As DataSet1TableAdapters.UsuarioTableAdapter = New DataSet1TableAdapters.UsuarioTableAdapter
        Dim table As DataSet1.UsuarioDataTable
        table = ta.GetDataByLoginSenha(txtLogin.Text, txtSenha.Text.GetHashCode)
        If table.Rows.Count > 0 Then
            Session("IdUsuario") = table.Rows(0).Item("IdUsuario")
            Session("Login") = table.Rows(0).Item("Login")
            If Session("Login") = "admin" Then
                Session("EhAdmin") = True
            End If
            Response.Redirect("Home.aspx")
        Else
            Response.Write("RODNEI COUTO")
        End If

    End Sub
End Class